<template>
  <div class="performance-evaluation-container">
    <left-right-structure>
      <div slot="left" class="brief-description">
        <div>{{ personalPortrait.character }}</div>
        <div class="imgWarp">
          <img src="../assets/辟谣三连.png" alt="" />
        </div>
        <div>{{ personalPortrait.username }}</div>
        <div>{{ personalPortrait.work }}</div>
        <div v-for="item in personalPortrait.scores" :key="item.label">
          {{ item.label }}: {{ item.value }}
        </div>
      </div>
      <radar :radarData="radarData" v-if="radarData" slot="right"></radar>
    </left-right-structure>
  </div>
</template>

<script>
import Radar from "@/components/data_analysis/graphs/Radar.vue";
import LeftRightStructure from "@/components/LeftRightStructure.vue";
export default {
  components: { Radar, LeftRightStructure },
  name: "PerformanceEvaluation",
  data() {
    return {
      personalPortrait: {},
      radarData: null,
    };
  },
  mounted() {
    // TODO:接口参数设置
    const { student_id } = JSON.parse(localStorage.getItem("userInfo"));
    this.$http
      .get(`${this.$reqPrefix}/kpi/personalLevel?student_id=${student_id}`)
      .then((res) => {
        const { graphData: radarData, personalPortrait } = res.data.data;
        this.personalPortrait = personalPortrait;
        this.radarData = radarData;
        console.log(radarData);
      });
  },
};
</script>

<style lang='less' scoped>
.performance-evaluation-container {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: space-between;
  .radar-container {
    // flex: 1;
    width: 48%;
    background-color: #fff;
  }

  .brief-description {
    // flex: 1;
    // background-color: green;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: #fff;
    .imgWarp {
      width: 200px;
      height: 200px;
      border-radius: 50%;
      overflow: hidden;
      img {
        width: 100%;
        height: 100%;
      }
    }
  }
}
</style>